package com.itheima.mapper;

import com.itheima.pojo.BookCategory;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface BookCategoryMapper {

    @Insert("insert into book_category(category_name, description, create_user, create_time, update_time)" +
            " values (#{categoryName},#{description},#{createUser},#{createTime},#{updateTime})")
    void addBookCategory(BookCategory bookCategory);

    @Select("select *from book_category")
    List<BookCategory> listBookCategry();
    @Update("update book_category set category_name=#{categoryName},description=#{description} ,update_time=#{updateTime} where id=#{id}")
    void updateBookCategory(BookCategory bookCategory);
    @Delete("delete from book_category where id=#{id}")
    void deleteBookCategory(Integer id);
    @Select("select *from book_category where id=#{id}")
    BookCategory findById(Integer id);
}
